#include<stdio.h>
#include<unistd.h>
#include<sys/wait.h>
#include<stdlib.h>
int main(){
    pid_t ret = fork();
    if(ret == -1){
        return -1;
    }else if(ret == 0){
        //child
        printf("I am child,pid = %d ppid= %d\n",getpid(),getppid());
        exit(99);
    }else{
        //father pid:这个含义就是刚刚创建出来的子进程的PID
        printf("I am father,pid = %d,ppid = %d\n",getpid(),getppid());
        int re  = 0;
        do{
             re = waitpid(ret,NULL,WNOHANG);      
        }while(re == 0);
        while(1){
            sleep(1);
        }
    }
    return 0;
}
